﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management.Automation;
using System.Management.Automation.Provider;


namespace SharePoint.Utilities.Cmdlets
{
    [Cmdlet("Update", "TaxonomyFields")]
    public class UpdateTaxonomyFieldsCommand : Cmdlet
    {


        [Parameter(Mandatory = true, HelpMessage = "Specify SiteCollection Url")]
        public string SiteCollectionUrl { get; set; }


        protected override void ProcessRecord()
        {
            this.WriteObject("Updating...");
            UpdateTaxonomyFieldsHelper.siteCollectionUrl = SiteCollectionUrl;
            UpdateTaxonomyFieldsHelper.UpdateTaxonomyFields();
            this.WriteObject("Done");


        }
    }

    /// <summary>
    /// This is a class to link taxonomy fields migrated to right term store
    /// </summary>
    [Cmdlet("Update", "TaxonomyFieldsWithSspId")]
    public class UpdateTaxonomyFieldsWithSspIdCommand : Cmdlet
    {


        [Parameter(Mandatory = true, HelpMessage = "Specify SiteCollection Url")]
        public string SiteCollectionUrl { get; set; }

        [Parameter(Mandatory = true, HelpMessage = "Specify Term Store Name")]
        public string TermStoreName { get; set; }

        protected override void ProcessRecord()
        {
            this.WriteObject("Updating...");
            UpdateTaxonomyFieldsHelper.UpdateTaxonomyFieldsWithSspId(SiteCollectionUrl, TermStoreName);
            this.WriteObject("Done");


        }
    }
}
